// {
// "goodsId": "44021506-ce30-4a19-88ea-79ae39c5890b",
// "code": "61206",
// "icon": "1",
// "type": "0",
// "subType": 0,
// "tags": "Special Offer",
// "discount": 0.60,
// "originalPrice": 4.99,
// "price": 1.99,
// "exchangeCoin": 500,
// "originalExchangeCoin": 0,
// "originalPriceRupee": 490.00,
// "priceRupee": 200.00,
// "localPaymentPriceRupee": 180.00,
// "isPromotion": true,
// "localPayOriginalPrice": 490,
// "localPayPrice": 180
// }

import 'package:ceramics/util/ab_value_converter.dart';

class ABCoin {
  /// 商品ID
  String? goodsId;
  /// 商品编码
  String? code;
  /// 商品图标
  String? icon;
  /// 类型
  String? type;
  /// 子类型
  int? subType;
  /// 标签
  String? tags;
  /// 折扣
  double? discount;
  /// 原价
  double? originalPrice;
  /// 价格
  double? price;
  /// 兑换币
  int? exchangeCoin;
  /// 原始兑换币
  int? originalExchangeCoin;
  /// 原始卢比价格
  double? originalPriceRupee;
  /// 卢比价格
  double? priceRupee;
  /// 本地支付卢比价格
  double? localPaymentPriceRupee;
  /// 是否促销
  bool? isPromotion;
  /// 本地支付原价
  double? localPayOriginalPrice;
  /// 本地支付价格
  double? localPayPrice;

  static ABCoin fromJson(Map<String, dynamic> json) {
    return ABCoin()
      ..goodsId = valueToString(json['goodsId'])
      ..code = valueToString(json['code'])
      ..icon = valueToString(json['icon'])
      ..type = valueToString(json['type'])
      ..subType = valueToInt(json['subType'])
      ..tags = valueToString(json['tags'])
      ..discount = valueToDouble(json['discount'])
      ..originalPrice = valueToDouble(json['originalPrice'])
      ..price = valueToDouble(json['price'])
      ..exchangeCoin = valueToInt(json['exchangeCoin'])
      ..originalExchangeCoin = valueToInt(json['originalExchangeCoin'])
      ..originalPriceRupee = valueToDouble(json['originalPriceRupee'])
      ..priceRupee = valueToDouble(json['priceRupee'])
      ..localPaymentPriceRupee = valueToDouble(json['localPaymentPriceRupee'])
      ..isPromotion = valueToBool(json['isPromotion'])
      ..localPayOriginalPrice = valueToDouble(json['localPayOriginalPrice'])
      ..localPayPrice = valueToDouble(json['localPayPrice']);
  }
}